﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Change_Shop.aspx.cs" Inherits="JKF.Web.Customer.EditCustomer.Change_Shop" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <%= RegScript("~/js/jquery.1.5.js")%>
    <%=RegScript("~/js/Common.js")%>
    <%=RegScript("~/js/jquery.json.js")%>
    <%=RegScript("~/js/jquery.nhis.js")%>
    <%=RegScript("~/js/jquery.rchis.js")%>
    <%=RegScript("~/js/jquery.validate.js")%>
    <%=RegScript("~/js/DatePicker/WdatePicker.js")%>
    <%=RegStyle("~/js/suggest/jquery.suggest.css")%>
    <%=this.RegStyle("~/App_Themes/Theme2/Include.css")%>
    <style type="text/css">
        body { height: auto; }
    </style>
    <script type="text/javascript">
        var canChange = <%=CanChangeShop%>;
        var appPath = "<%=AppPath %>";
        var areaHandler = appPath + '/do/Dic/Dic_Area.do';
        var curstomerHandler = appPath + '/do/Customer/Customer.do';
        $(function () {
            if (!canChange) {
                $("#btnSure").remove();
                return;
            }
            alxVr.push({
                id: "NEW_SHOP_CODE",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length == 0) {
                        this.msg = "请选择新店面.";
                        return false;
                    }
                    return true;
                }
            });
            $.validateBind();
            $("#btnSure").click(ChangeShop);
        });

        function ChangeShop() {
            if (!$.validateAll()) {
                if ($(".alxv-failed").size() > 0) {
                    $(document).scrollTop($(".alxv-failed").eq(0).scrollTop());
                }
                return;
            };
            $.post(curstomerHandler, { ActionName: "ChangeShop", shopCode: $.trim($("#NEW_SHOP_CODE").val()), customerKey: $.trim($("#CURSTOMER_KEY").val()) }, function (rslt) {
                if (rslt.Success) {
                    var selShop = $("#NEW_SHOP_CODE").find("option[value='" + rslt.Data + "']").eq(0).text();
                    $("#OLD_SHOP_CODE").val(selShop);
                    $("#NEW_SHOP_CODE").val("");
                    alert("操作成功.");
                    return;
                }
                alert(rslt.Message);
            }, "json");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="pop_logging_body">
            <table width="100%" class="common_table_noborde">
                <tr>
                    <td width="18%" align="right">旧店面：<input type="hidden" id="CURSTOMER_KEY" value="<%=CustomerKey%>" />
                    </td>
                    <td>
                        <input type="text" id="OLD_SHOP_CODE" value="<%=CurstomerShopName%>" disabled="disabled" class="common_search_input w150" />
                    </td>
                </tr>
                <tr>
                    <td width="18%" align="right">新店面：
                    </td>
                    <td>
                        <select id="NEW_SHOP_CODE" class="common_search_select w150">
                            <option value="">请选择</option>
                            <%=ShopOptions%>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align: left;">
                        <input type="button" id="btnSure" value="" class="common_btn_save mr30 mb25" />
                        <input type="button" value="" class="common_btn_remove mb25" onclick="top.tipsWindown.close();" /></td>
                </tr>
            </table>
        </div>

    </form>
</body>
</html>
